package huoye.shops.huoye.mine.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.codeideology.android.lang.entity.Paging;
import com.codeideology.android.widget.recycler.RecyclerViewAdapter;

import huoye.shops.base.BaseActivity;
import huoye.shops.base.PullToRefreshFragment;
import huoye.shops.huoye.mine.adapter.RecordPayAdapter;
import huoye.shops.huoye.mine.model.PostDepositRec;
import huoye.shops.huoye.mine.presenter.RecordPayPresenter;
import huoye.shops.huoye.mine.view.IRecordPayRefreshView;
import huoye.shops.huoye.operation.activity.DiscountCancelActivity;
import huoye.shops.huoye.operation.adapter.QueueShopAdapter;
import huoye.shops.huoye.operation.model.QueueShops;
import huoye.shops.huoye.operation.presenter.QueueShopPresenter;
import huoye.shops.huoye.operation.view.IQueueShopRefreshView;


public class RecordPayFragment extends PullToRefreshFragment<PostDepositRec> implements IRecordPayRefreshView {

    public static final int TYPE_RECPRD_PAY_ALL  = 0; //全部
    public static final int TYPE_RECPRD_PAY_WITHDRAW  = 1; //提现
    public static final int TYPE_RECPRD_PAY_SELL  = 2; //销售
    public static final int TYPE_RECPRD_PAY_PUSH  = 3; //提成
    public static final int TYPE_RECPRD_PAY_PRIZE  = 4; //礼包核销    （目前用不到）


    private RecordPayPresenter mRecordPayPresenter;

    private int mType;



    @Override
    public RecyclerViewAdapter createAdapter() {

        Bundle bundle = getArguments();
        mType = bundle.getInt(BaseActivity.EXTRAS_KEY_DATA);
        RecordPayAdapter adapter = new RecordPayAdapter(getActivity());
        return adapter;
    }



    @Override
    protected void initView(View view, @Nullable Bundle bundle) {
        super.initView(view, bundle);

        mRecordPayPresenter = new RecordPayPresenter();
        mRecordPayPresenter.addTaskListener(this);
        mRecordPayPresenter.onStart();
        query();


    }



    @Override
    public void query(Paging paging) {
        super.query(paging);
        mRecordPayPresenter.getRecordPost(mType,paging);

    }


    public static RecordPayFragment getInstan(int type) {
        RecordPayFragment fragment = new RecordPayFragment();
        Bundle bundle = new Bundle();
        bundle.putInt(BaseActivity.EXTRAS_KEY_DATA, type);
        fragment.setArguments(bundle);
        return fragment;

    }


    @Override
    public void onItemClick(PostDepositRec postDepositRec, int i, View view) {

    }
}
